import React from 'react';
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';  
import routes from './routes/index';
const Load = React.lazy(() => import('./views/loading'));

function App() {
  return (
    <div className="App">
      <Router>
        <React.Suspense fallback={<> <Load /> </>}>
          <Routes>
              {routes.map(route => (  
                <Route key={route.path} path={route.path} element={route.element} />  
              ))}  
          </Routes>
        </React.Suspense>
      </Router>
    </div>
  );
}

export default App;
